<template>
	<!-- 公告 -->
	<view class="notice-center">
		<nav-bar title="公告" @_back="_back" />
		<view class="container">
			<view class="notice-box" v-for="item in list" :key="item.id" @click="jump(item.id)">
				<view class="white-text">
					<text>{{item.title}}</text>
				</view>
				<text class="time">{{item.time}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import minix from '@/utils/minix.js'
	import { newsList } from '@/api/index.js'
	export default {
		mixins: [minix],
		data() {
			return {
				list: []
			}
		},
		mounted() {
			this.getNewsList()
		},
		methods: {
			jump(id) {
				uni.navigateTo({
					url: '/pages/notice/detail?id=' + id
				})
			},
			// 获取公告
			async getNewsList() {
				let {error, res } = await newsList({c_id: 4});
				if (error) return;
				this.list = res.list || [];
			}
		}
	}
</script>

<style lang="scss" scoped>
	.notice-center {
		.container {
			margin-top: 30rpx;
			.notice-box {
				padding: 30rpx 0;
				height: 128rpx;
				border-bottom: 1px solid rgba(255, 255, 255, .1);
				font-weight: bold;
				font-size: 32rpx;
				.white-text {
					height: 32rpx;
					line-height: 32rpx;
				}
				.time {
					font-weight: normal;
					font-size: 22rpx;
					height: 22rpx;
					line-height: 22rpx;
					color: rgba(255, 255, 255, .4);
				}
			}
		}
	}
</style>
